import dynamicRouter from "../../router/lazyRouter"

/**
 * 懒加载动态路由
 */
function lazy(code) {
  //return  resolve => require(["@/components/" + name + ".vue"], resolve)
  return getComponentByPath('/' + code);
}

function getComponentByPath(path) {
  for (let i = 0; i < dynamicRouter.length; i++) {
    let route = dynamicRouter[i];
    if (route.path === path) {
      return route.component;
    }
  }
}


export {lazy}

